﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Continuum.Classes;

namespace Continuum
{
    public partial class ManageActors : Form
    {
        BindingSource _bindsrc = new BindingSource();

        #region Constructor/Load

        public ManageActors()
        {
            InitializeComponent();
        }

        private void ManageActors_Load(object sender, EventArgs e)
        {
            _bindsrc.DataSource = MainForm.projector.Actors;
            lstActors.DataSource = _bindsrc;
        }

        #endregion

        private void btnNewActor_Click(object sender, EventArgs e)
        {
            Actor _actor = new Actor("New Actor", null, ActorPeriodicityEnum.Monthly, 1, DateTime.Now, 0.00m);
            MainForm.projector.Actors.Add(_actor);
            propertyGrid1.SelectedObject = _actor;
            _bindsrc.ResetBindings(false);
        }

        private void lstActors_SelectedIndexChanged(object sender, EventArgs e)
        {
            propertyGrid1.SelectedObject = lstActors.SelectedItem;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
        }

    }
}
